Given an array arr[] of size N, the task is to find the number of subarrays having the sum of its elements equal to the number of elements in it....
Given an array arr[] containing n integers. The problem is to find the length of the subarray having maximum sum. If there exists two or more subarrays with maximum sum then print the length of the longest subarray.Examples:...
Given an array containing n numbers. The problem is to find the maximum sum bitonic subarray. A bitonic subarray is a subarray in which elements are first increasing and then decreasing. A strictly increasing or strictly decreasing subarray is also considered a bitonic subarray. Time Complexity of O(n) is required....
Given integer N, the task is to count the number of ways( modulo 109 + 7) to create an N digit number from digits 1 to 9 such that adjacent digits are different and the number is divisible by 3....
Given two strings A and B of size N and M respectively, where B is a sub-sequence of A and an array arr[] of size N, where arr[i] is the cost to delete ith character from string A. The task is to find the minimum cost to delete characters from A such that after deletion no subsequence of A is the same as B....
Rahul and Ankit are the only two waiters in the Royal Restaurant. Today, the restaurant received N orders. The amount of tips may differ when handled by different waiters and given as arrays A[] and B[] such that if Rahul takes the ith Order, he would be tipped A[i] rupees, and if Ankit takes this order, the tip would be B[i] rupees....
Given two arrays arr1[] and arr2[] of length M and N consisting of digits [0, 9] representing two numbers and an integer K(K ? M + N), the task is to find the maximum K-digit number possible by selecting subsequences from the given arrays such that the relative order of the digits is the same as in the given array....
Given an array arr[] of size n, a sequence is called valid if it is in series of blocks where each starting element denotes the length of the block i.e first comes the length of the block then its element, for example the sequence [3 3 4 5 2 6 1], here the blocks are [3 3 4 5] and [2 6 1]. In one operation you can remove any one element of the array. The task is to determine the minimum number of operations required to make the array a valid sequence....
Given an unsorted array, trim the array such that twice of minimum is greater than the maximum in the trimmed array. Elements should be removed from either end of the array. The number of removals should be minimum....
Given a set of coin denominations the total number of coins (n) and a target amount (target), the task is to determine if it’s possible to make change, for the target amount using k coins. You have one supply of each coin denomination....
Given an array of integer nums[] and a positive integer K, the task is to find the maximum number of integers that can be selected from the array such that the sum of the number of 1s in their binary representation is at most K....
Given an array arr[] of N elements. The task is to find the number of sub-sequences which have at least two consecutive elements such that absolute difference between them is ? 1....